package cn.zyx.org.service.impl;

import cn.zyx.pet.domain.Pet;
import cn.zyx.pet.domain.PetDetail;
import cn.zyx.pet.mapper.PetDetailMapper;
import cn.zyx.pet.mapper.PetMapper;
import cn.zyx.pet.service.IPetService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

public class PetInit extends BaseTest {

    @Autowired
    private PetMapper petMapper;

    @Autowired
    private PetDetailMapper petDetailMapper;

    @Autowired
    private IPetService petService;

    @Test
    public void testInit(){
        for(int i=0;i<50; i++){
            Pet pet = petMapper.loadById(74L);
            PetDetail petDetail = petDetailMapper.loadByPetId(pet.getId());
            pet.setId(null);
            pet.setName(pet.getName() +"【" +i+"】");
            petDetail.setId(null);
            pet.setDetail(petDetail);
            petService.add(pet);
        }

    }
}
